#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int sol(const string& cs)
{
	vector<int> iv(cs.size() + 1, 0);
	iv[0] = iv[1] = 1;
	for (int i = 1; i < cs.size(); ++i)
	{
		if (cs[i] == '0')
		{
			if (i == 1)
				iv[i] = 1;
			else
				iv[i] = iv[i - 2];
			continue;
		}
		iv[i] = iv[i - 1];
		int num = (cs[i - 1] - '0') * 10 + cs[i] - '0';
		if(num>=10&&num<=26)
		{
			if (i == 1)
				iv[i] += 1;
			else
				iv[i] += iv[i - 2];
		}
	}
	//for_each(iv.begin(), iv.end(), [](int n) {cout << n << " "; });
	//cout << endl;
	return iv[cs.size()-1];
}

int main()
{
	string str;
	while(cin>>str)
	{
		if (str == "0")
			return 0;
		cout << sol(str) << endl;
	}
	return 0;
}
